package com.company.hrmadmin.modules.controller;

import com.company.hrmadmin.common.constant.Result;
import com.company.hrmadmin.modules.entity.dto.employee.DepNameDTO;
import com.company.hrmadmin.modules.entity.dto.employee.EmpTypeDTO;
import com.company.hrmadmin.modules.service.DepartmentService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author Song, Wei
 * Date: 2022/4/20 10:47
 */
@Slf4j
@RestController
@RequestMapping("/emp")
public class EmployeeController {

    @Autowired
    private DepartmentService departmentService;

    @GetMapping("/dep/name/list")
    public Result<List<DepNameDTO>> getDepNameList(Integer userId) {
        log.info("获取所有部门的名称，参数：{}", userId);
        return Result.success(departmentService.getDepNameList(userId));
    }

    @GetMapping("/type/list")
    public Result<List<EmpTypeDTO>> getEmpTypeList() {
        log.info("获取所有员工的类型");
        return Result.success(departmentService.getEmpTypeList());
    }

}
